package com.mcptt.config.group.sub;

import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.Namespace;

public class DisplayName
{
	public static final String Name = "display-name";
	private static final String Namespace_Xml = "xml";
	private static final String Name_Lang = "lang";
	private String lang = "en-us";
	private String displayName = "";

	public void parse(Element elem) throws JDOMException
	{
		if(elem == null)
		{
			return;
		}
		Namespace namespace = elem.getNamespace(Namespace_Xml);
		lang = elem.getAttributeValue(Name_Lang,namespace);
		displayName = elem.getText();
	}
	
	public String toString()
	{
		StringBuffer strBuf = new StringBuffer("\r\n");
		strBuf.append("<").append(Name).append(" ");
		strBuf.append(Namespace_Xml).append(":").append(Name_Lang).append("=\"").append(lang).append("\">");
		strBuf.append(displayName).append("</").append(Name).append(">").append("\r\n");

		return strBuf.toString();
	}
}
